home *** CD-ROM | disk | FTP | other *** search
/ Mac Format 1994 October / Macformat17.cdr / Shareware City / Developers / GAL ƒ / GAL examples / Max of 3 < prev    next >
Text File  |  1994-07-11  |  468b  |  18 lines

  1. ; find the maximum of three numbers
  2.         begin_code
  3.         copy                 n=>r0            first number in loc n
  4.         compare          n+2=>r0        second in loc n+1
  5.         jump:less_than    first
  6.         copy                 n+2=>r0        larger of first 2 in r0
  7. first    compare          n+4=>r0        third number in loc n+2
  8.          jump:less_than    still
  9.         copy                 n+4=>r0        largest of all 3 in r0
  10. still copy              r0=>max
  11.         halt
  12.           end_code
  13.          begin_data                            
  14. n        constant:integer            15,2,67        3 data values
  15. max    variable:integer            1
  16.         end_data
  17.      end
  18.